# -*- coding: utf-8 -*-

# -------------------------------
# Author    : linlingwei
# Email     : 951035650@qq.com
# File Name : uninstall.py
# Date      : 2018/8/25
# Version   : 1.0.1
# -------------------------------

import os
import sys
import getpass

try:
    import maya.mel
    import maya.cmds
    isMaya = True
except ImportError:
    isMaya = False
def uninstall_modules():
    user_name = getpass.getuser()
    # C:\Users\Admin\Documents\maya\modules
    modules_path = os.path.join("C:\Users", user_name, "Documents\maya\modules")
    if not os.path.exists(modules_path):
        return
    modules_file = "correctShape.mod"
    modules_file_path = os.path.join(modules_path, modules_file)
    if os.path.exists(modules_file_path):
        os.remove(modules_file_path)
        
    return

def uninstall():
    
    uninstall_modules()

    srcPath = os.path.join(os.path.dirname(__file__))
    srcPath = os.path.normpath(srcPath)
    sys.path.remove(srcPath)
    sys.path.remove(os.path.join(srcPath,"scripts"))
    return
if isMaya:
    uninstall()
    print "uninstall correctShape success."

if __name__ == '__main__':
    pass